[#ftl]
[@define "agile.dijit.ToolbarItem"  "agile._Component"]		
	 	agileWidgetName:"ToolbarItem"	
	 	,widgetName:"form.Button"
	 	,shortName:"ToolbarItem"
		[#assign templateString][#compress]
			<div class='agileComponent agileToolbarItem'>
	 			<img class='{parameters.iconClass}' data-dojo-attach-point='iconNode'/>							
			</div>
		[/#compress][/#assign]
		,templateString:"${templateString?js_string}"			
//		,_items:{
//			"Cancel":{label:"Cancel",iconClass:"Cancel",accelKey:"Ctrl + Z"}
//			,"Copy":{label:"Copy",iconClass:"Copy",accelKey:"Ctrl + C"}
//			,"Cut":{label:"Cut",iconClass:"Cut",accelKey:"Ctrl + X"}
//			,"Delete":{label:"Delete",iconClass:"Delete",accelKey:"Ctrl + D"}
//			,"Paste":{label:"Paste",iconClass:"Paste",accelKey:"Ctrl + P"}
//			,"Redo":{label:"Redo",iconClass:"Redo",accelKey:"Ctrl + R"}
//			,"Save":{label:"Save",iconClass:"Save",accelKey:"Ctrl + S"}
//			,"Undo":{label:"Undo",iconClass:"Undo",accelKey:"Ctrl + U"}
//		}	
		,styleConstraints:agile.delegate(agile._Component.prototype.styleConstraints,{
			"left": {ignore:function(widget,sourceType){return sourceType != "agile";}}
			,"top": {_readOnly:true	,_ignore:true}
		    ,"height":{_ignore:true,_readOnly:true}
		    ,"width":{_ignore:true,_readOnly:true}
		    ,"position":{_ignore:true,_readOnly:true}
		    ,"z-index":{_ignore:true,_hidden:true}
		})
		,attributes:agile.delegate(agile._Component.prototype.attributes,{
//			"style.left": {
//				ignore:function(widget,sourceType){
//					return sourceType != "agile";
//				}
//				,_hidden:true
//			}
//			,"style.top":{_ignore:true,_hidden:true}
//			,"style.position":{_ignore:true}
//		    ,"style.height":{_ignore:true}
//		    ,"style.width":{_ignore:true}
//		    ,showLabel: lang.mixin({},agile.BooleanMetadata,{_ignore:true})
//			,label:lang.mixin({},agile.TextMetadata,{_ignore:true})
			iconClass:lang.mixin({},agile.ComboMetadata,{
				label:"i18n_icon"	
				,options:[{value:"Cancel",iconClass:"Cancel",accelKey:"Ctrl + Z"}
						,{value:"Copy",iconClass:"Copy",accelKey:"Ctrl + C"}
						,{value:"Cut",iconClass:"Cut",accelKey:"Ctrl + X"}
						,{value:"Delete",iconClass:"Delete",accelKey:"Ctrl + D"}
						,{value:"Paste",iconClass:"Paste",accelKey:"Ctrl + P"}
						,{value:"Redo",iconClass:"Redo",accelKey:"Ctrl + R"}
						,{value:"Save",iconClass:"Save",accelKey:"Ctrl + S"}
						,{value:"Undo",iconClass:"Undo",accelKey:"Ctrl + U"}
			            ]
			
//				,initOptions:function(){
//					this.options = {};
//					var items =agile.dijit.ToolbarItem.prototype._items;
//					for(var name in items){
//						this.options[name] = items[name].iconClass;
//					};
//				}
				,onValueChange:function(widget,name,value){
					value = this.parse(value);					
					domClass.replace(widget.iconNode,value);
					widget.metadata(this.metadataCategory+"."+name,value);					
					//agile.dijit.MenuItem.prototype.attributes.iconClass.editorWidget.set("value",value);					
				}
				,format:function(value){
					if(value && value.indexOf("dijitEditorIcon") == 0){									
						value = value.replace('dijitEditorIcon dijitEditorIcon',"");
					}					
					return value;
				}
				,parse:function(value){
					if(value && value.indexOf("dijitEditorIcon") < 0){
						value = "dijitEditorIcon dijitEditorIcon"+value;
					}
					return value;
				}
			})
			,disabled:lang.mixin({},agile.BooleanMetadata,{	
				label:"i18n_disabled"
			})												
		})	
		,events:agile.delegate(agile._Component.prototype.events,{
			"onClick": {_ignore:false}
		})
		,initDefaultMetadata:function(){
			this.metadata("parameters.iconClass","dijitEditorIcon dijitEditorIconCut");		
			this.metadata("dojoDeclaredClass","dijit.form.Button");
		}			
		,getPreferredSize:function(){
			return {w:25,h:25}
		}
		,getDescription:function(){
			return "Toolbar Item";
		}
	[/@]
